package cn.hongwei.beanfactoryprocessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * @author Great
 * @email 1224028994@qq.com
 * 实现bean工厂的后置处理器,然后通过bean工厂 -->DefaultListableBeanFactory
 * 手动向IOC容器注册bean
 */
@Component
public class MyProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        /*
        * 注册单利bean
        * */
        beanFactory.registerSingleton("orderDao",new OrderDao());
    }
}
